from dotenv import load_dotenv
from pydantic import Field, ValidationError
from pydantic_settings import BaseSettings, SettingsConfigDict


class Manager(BaseSettings):
    id: int = Field(..., description='ID менеджера')
    name: str = Field(..., description='Имя менеджера')
    password: str = Field(..., description='Пароль менеджера')


class CarShop(Manager):
    car_model: str = Field(..., description='Модель машины')
    car_price: int = Field(..., description='Цена машины')


class Settings(CarShop):
    model_config = SettingsConfigDict(env_file='.env', extra='ignore', env_prefix="MANAGER_")


def main():
    load_dotenv()
    try:
        settings = Settings()
        print(settings.model_dump_json())
    except ValidationError as e:
        print("Ошибка валидации:", e)


if __name__ == '__main__':
    main()
